from django.test import TestCase
import MySQLdb
import json
# Create your tests here.




cur = MySQLdb.connect(host='127.0.0.1',port=3306,user='root',passwd='123456',db='computer_status',charset='utf8')
cursor = cur.cursor()
cursor.execute("select * from sign_computer_status")
all = cursor.fetchall()
sql = """insert into `computerstatus_computerstatus`(name,name_yu,computer_name,system_type,c_cpu,c_memory,c_network,
            c_display,c_date,mac_network,it_number,seat_number,asset_users,c_time) value {}"""

for a in all:

    b = list(a)
    b = b[1:]
    b[-1] = "2020-10-15 00:00:00.000000"

    a = tuple(b)
    sql = sql.format(str(a))
    print(cursor.execute(sql))
